﻿using Dapper.Contrib.Extensions;
using Gx.Common;
using Gx.Model.Enums;
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Gx.Model.Entity
{
    [System.ComponentModel.DataAnnotations.Schema.Table("LK_ZeroWarehouseContract")] 
    public class LKZeroWarehouseContract
    {
        [System.ComponentModel.DataAnnotations.Key]
        private int _id;
        /// <summary>
        /// Id
        /// </summary>
        [Column("Id")]
        public int Id 
        {
            get
            {
                return _id;
            }
            set { _id = value; }
        }
        
        
        private string _contractNo;
        /// <summary>
        /// 合同编号
        /// </summary>
        [Column("ContractNo")]
        public string ContractNo 
        {
            get
            {
                if(string.IsNullOrWhiteSpace(_contractNo))
                    _contractNo=string.Empty;
                return _contractNo;
            }
            set { _contractNo = value; }
        }
        
        
        private int _customerId;
        /// <summary>
        /// 客户
        /// </summary>
        [Column("CustomerId")]
        public int CustomerId 
        {
            get
            {
                return _customerId;
            }
            set { _customerId = value; }
        }
        
        
        private string _customerName;
        /// <summary>
        /// 客户名称
        /// </summary>
        [Column("CustomerName")]
        public string CustomerName 
        {
            get
            {
                if(string.IsNullOrWhiteSpace(_customerName))
                    _customerName=string.Empty;
                return _customerName;
            }
            set { _customerName = value; }
        }
        
        
        private System.DateTime _contractTime;
        /// <summary>
        /// 开单日期
        /// </summary>
        [Column("ContractTime")]
        public System.DateTime ContractTime 
        {
            get
            {
                if (_contractTime == DateTime.MinValue)
                {
                    return DateTime.Parse("1911-01-01");
                }
                return _contractTime;
            }
            set { _contractTime = value; }
        }
        
        
        private System.DateTime _beginTime;
        /// <summary>
        /// 开始日期
        /// </summary>
        [Column("BeginTime")]
        public System.DateTime BeginTime 
        {
            get
            {
                if (_beginTime == DateTime.MinValue)
                {
                    return DateTime.Parse("1911-01-01");
                }
                return _beginTime;
            }
            set { _beginTime = value; }
        }
        
        
        private System.DateTime _endTime;
        /// <summary>
        /// 结束日期
        /// </summary>
        [Column("EndTime")]
        public System.DateTime EndTime 
        {
            get
            {
                if (_endTime == DateTime.MinValue)
                {
                    return DateTime.Parse("1911-01-01");
                }
                return _endTime;
            }
            set { _endTime = value; }
        }
        
        
        private int _tonnage;
        /// <summary>
        /// 不足n吨算n吨
        /// </summary>
        [Column("Tonnage")]
        public int Tonnage 
        {
            get
            {
                return _tonnage;
            }
            set { _tonnage = value; }
        }
        
        
        private bool _isByTon;
        /// <summary>
        /// 按吨操作
        /// </summary>
        [Column("IsByTon")]
        public bool IsByTon 
        {
            get
            {
                return _isByTon;
            }
            set { _isByTon = value; }
        }
        
        
        private int _chargingUnit;
        /// <summary>
        /// 计费单位
        /// </summary>
        [Column("ChargingUnit")]
        public int ChargingUnit 
        {
            get
            {
                return _chargingUnit;
            }
            set { _chargingUnit = value; }
        }
        
        
        private decimal _coldUnitPrice;
        /// <summary>
        /// 冷藏单价
        /// </summary>
        [Column("ColdUnitPrice")]
        public decimal ColdUnitPrice 
        {
            get
            {
                return _coldUnitPrice;
            }
            set { _coldUnitPrice = value; }
        }
        
        
        private int _coldAlgorithm;
        /// <summary>
        /// 冷藏算法
        /// </summary>
        [Column("ColdAlgorithm")]
        public int ColdAlgorithm 
        {
            get
            {
                return _coldAlgorithm;
            }
            set { _coldAlgorithm = value; }
        }
        
        
        private int _cycle;
        /// <summary>
        /// 周期
        /// </summary>
        [Column("Cycle")]
        public int Cycle 
        {
            get
            {
                return _cycle;
            }
            set { _cycle = value; }
        }
        
        
        private string _remark;
        /// <summary>
        /// 备注
        /// </summary>
        [Column("Remark")]
        public string Remark 
        {
            get
            {
                if(string.IsNullOrWhiteSpace(_remark))
                    _remark=string.Empty;
                return _remark;
            }
            set { _remark = value; }
        }
        
        
        private bool _isValid;
        /// <summary>
        /// 是否停用
        /// </summary>
        [Column("IsValid")]
        public bool IsValid 
        {
            get
            {
                return _isValid;
            }
            set { _isValid = value; }
        }
        
        
        private System.DateTime _createTime;
        /// <summary>
        /// 创建时间
        /// </summary>
        [Column("CreateTime")]
        public System.DateTime CreateTime 
        {
            get
            {
                if (_createTime == DateTime.MinValue)
                {
                    return DateTime.Parse("1911-01-01");
                }
                return _createTime;
            }
            set { _createTime = value; }
        }
        
        
        private int _createUserId;
        /// <summary>
        /// 创建人id
        /// </summary>
        [Column("CreateUserId")]
        public int CreateUserId 
        {
            get
            {
                return _createUserId;
            }
            set { _createUserId = value; }
        }
        
        
        private string _createUser;
        /// <summary>
        /// 创建人
        /// </summary>
        [Column("CreateUser")]
        public string CreateUser 
        {
            get
            {
                if(string.IsNullOrWhiteSpace(_createUser))
                    _createUser=string.Empty;
                return _createUser;
            }
            set { _createUser = value; }
        }
        
        
        private int _modifyUserId;
        /// <summary>
        /// 修改人id
        /// </summary>
        [Column("ModifyUserId")]
        public int ModifyUserId 
        {
            get
            {
                return _modifyUserId;
            }
            set { _modifyUserId = value; }
        }
        
        
        private string _modifyUser;
        /// <summary>
        /// 修改人
        /// </summary>
        [Column("ModifyUser")]
        public string ModifyUser 
        {
            get
            {
                if(string.IsNullOrWhiteSpace(_modifyUser))
                    _modifyUser=string.Empty;
                return _modifyUser;
            }
            set { _modifyUser = value; }
        }
        
        
        private System.DateTime _modifyTime;
        /// <summary>
        /// 修改时间
        /// </summary>
        [Column("ModifyTime")]
        public System.DateTime ModifyTime 
        {
            get
            {
                if (_modifyTime == DateTime.MinValue)
                {
                    return DateTime.Parse("1911-01-01");
                }
                return _modifyTime;
            }
            set { _modifyTime = value; }
        }
        
        
        private bool _isDeleted;
        /// <summary>
        /// 是否删除
        /// </summary>
        [Column("IsDeleted")]
        public bool IsDeleted 
        {
            get
            {
                return _isDeleted;
            }
            set { _isDeleted = value; }
        }

        private int _companyId;
        /// <summary>
        /// 公司
        /// </summary>
        [Column("CompanyId")]
        public int CompanyId
        {
            get
            {
                return _companyId;
            }
            set { _companyId = value; }
        }

        private int _status;
        /// <summary>
        /// 状态
        /// </summary>
        [Column("Status")]
        public int Status
        {
            get
            {
                return _status;
            }
            set { _status = value; }
        }

        private int _days;
        /// <summary>
        /// 天数
        /// </summary>
        [Column("Days")]
        public int Days
        {
            get
            {
                return _days;
            }
            set { _days = value; }
        }

        [Computed]
        public string StatusName 
        {
            get
            {
                return EnumHelper.GetDataTypeDescription<EntryBillStatus>(Status);
            }
        }


        [Computed]
        public string ChargingUnitName { get; set; }

        [Computed]
        public string ColdAlgorithmName { get; set; }
    }
}

